package game.source.util;

public class Time{
	private boolean pause;
	private long	pauseTime1;
	private long 	pausedTime;
	private long 	time;
	public Time(){
		this.pause		= false;
		this.pauseTime1	= 0;
		this.pausedTime	= 0;
		this.time		= System.currentTimeMillis();
	}
	public void pause(){
		if(!this.pause){
			this.pause		= true;
			this.time		= System.currentTimeMillis()-this.pausedTime;
			this.pauseTime1 = System.currentTimeMillis();
		}
	}
	public void play(){
		if(this.pause){
			this.pause		= false;
			this.pausedTime += (System.currentTimeMillis() - this.pauseTime1);
		}
	}
	public long getTime(){
		if(this.pause){
			return this.time;
		}else{
			return System.currentTimeMillis()-this.pausedTime;
		}
	}
}
